<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>类继承-2</title>
</head>
<body>
    <script>

        class Phone {
            //构造方法
            constructor(brand, price) {
                this.brand = brand;
                this.price = price;
            }

            //父类的成员属性
            call() {
                console.log('我可以打电话!!');
            }
        }

        class SmartPhone extends Phone {
            //构造方法
            constructor(brand, price, color, size) {
                //这里super直接调用父类中的构造方法
                super(brand, price);
                this.color = color;
                this.size = size;
            }

            photo() {
                console.log('拍照');
            }

            playGame() {
                console.log('玩游戏');
            }

            //父类方法的重写
            call() {
                console.log('我可以进行视频通话');
            }
            
        }

        const xiaomi = new SmartPhone('小米', 799, '黑色',' 4.7inch');
        console.log(xiaomi);
    </script>
</body>
</html>